package cn.iocoder.yudao.module.lfd.dal.mysql.shop;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.lfd.dal.dataobject.shop.LfdShopDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.lfd.controller.admin.shop.vo.*;

/**
 * 店铺 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface LfdShopMapper extends BaseMapperX<LfdShopDO> {

    default PageResult<LfdShopDO> selectPage(ShopPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LfdShopDO>()
                .eqIfPresent(LfdShopDO::getWorkTimes, reqVO.getWorkTimes())
                .eqIfPresent(LfdShopDO::getPhone, reqVO.getPhone())
                .betweenIfPresent(LfdShopDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(LfdShopDO::getAddress, reqVO.getAddress())
                .eqIfPresent(LfdShopDO::getLng, reqVO.getLng())
                .eqIfPresent(LfdShopDO::getLat, reqVO.getLat())
                .orderByDesc(LfdShopDO::getId));
    }

    default List<LfdShopDO> selectList(ShopExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<LfdShopDO>()
                .eqIfPresent(LfdShopDO::getWorkTimes, reqVO.getWorkTimes())
                .eqIfPresent(LfdShopDO::getPhone, reqVO.getPhone())
                .betweenIfPresent(LfdShopDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(LfdShopDO::getAddress, reqVO.getAddress())
                .eqIfPresent(LfdShopDO::getLng, reqVO.getLng())
                .eqIfPresent(LfdShopDO::getLat, reqVO.getLat())
                .orderByDesc(LfdShopDO::getId));
    }

}
